<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var reverseString = function (s) {
        s = s.split('')
        let left = 0
        let right = s.length - 1
        while (left < right) {
          ;[s[left], s[right]] = [s[right], s[left]]
          left++
          right--
        }
        console.log(s)
      }
      reverseString('abecd')
    </script>
  </body>
</html>
